package org.zfes.snowier.zbss.xzy.router.others;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.config.model.MoConfigItem;
import org.zfes.snowier.zbss.xzy.biz.config.service.IMoConfigItemService;
@Controller 
@RequestMapping("/xzy/moConfigItem")
public class MoConfigItemController implements BaseController {

	
	@Autowired
	private IMoConfigItemService moConfigItemService;
	
	@RequiresPermissions(value="moConfigItem:loadMoConfigItemDataSet",desc="监控配置列表")
    @RequestMapping(value="/loadMoConfigItemDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadMoConfigItemDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  moConfigItemService.loadMoConfigItemDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="moConfigItem:createMoConfigItem",desc="监控配置添加")
    @RequestMapping(value="/createMoConfigItem", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createMoConfigItem(MoConfigItem moConfigItem){
		moConfigItemService.createMoConfigItem(moConfigItem);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="moConfigItem:loadMoConfigItem",desc="监控配置加载")
    @RequestMapping(value="/loadMoConfigItem", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadMoConfigItem(Long id){
		Optional<MoConfigItem> ops = moConfigItemService.loadMoConfigItemById(id);
		return ajaxQuery("moConfigItem",ops);
    }
	
	@RequiresPermissions(value="moConfigItem:updateMoConfigItem",desc="监控配置更新")
    @RequestMapping(value="/updateMoConfigItem", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateMoConfigItem(MoConfigItem moConfigItem){
		moConfigItemService.updateMoConfigItem(moConfigItem);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="moConfigItem:deletMoConfigItem",desc="监控配置删除")
    @RequestMapping(value="/deleteMoConfigItem", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteMoConfigItem(Long id){
		moConfigItemService.deleteMoConfigItem(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}